﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Color.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!-- Border Style -->
    <Style x:Key="BorderStyle" TargetType="{x:Type Border}">
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultThickness), Mode=OneWay}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
    </Style>

    <!-- Drag Border Style - Used by Drag and Drop -->
    <Style x:Key="DragBorderStyle" TargetType="{x:Type Border}">
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
    </Style>

    <!-- RadialShadowBorder style -->
    <Style TargetType="controls:RadialShadowBorder">
        <Setter Property="RadialShadowColor" Value="#ff000000"/>
        <Setter Property="RadialShadowOpacity" Value="0.5"/>
        <Setter Property="RadialShadowWidth" Value="1.25"/>
        <Setter Property="RadialShadowSpread" Value="0"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:RadialShadowBorder">
                    <Grid>
                        <Ellipse x:Name="PART_Shadow" 
                                 Height="30" 
                                 Margin="0,0,0,-15" 
                                 Opacity="{TemplateBinding RadialShadowOpacity}" 
                                 RenderTransformOrigin="0.5,0.5"
                                 VerticalAlignment="Bottom">
                            <Ellipse.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform x:Name="PART_ShadowScale"/>
                                    <TranslateTransform x:Name="PART_ShadowTranslate"/>
                                </TransformGroup>
                            </Ellipse.RenderTransform>
                            <Ellipse.Fill>
                                <RadialGradientBrush>
                                    <GradientStop x:Name="PART_ShadowInnerStop"
                                                  Color="#ff000000" 
                                                  Offset="0" />
                                    <GradientStop x:Name="PART_ShadowOuterStop"
                                                  Color="#00000000" 
                                                  Offset="1"/>
                                </RadialGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                                 CornerRadius="{TemplateBinding CornerRadius}" 
                                                 Padding="{TemplateBinding Padding}"
                                                 BorderThickness="{TemplateBinding BorderThickness}"
                                                 BorderBrush="{TemplateBinding BorderBrush}"
                                                 ClipContent="{TemplateBinding ClipContent}">
                            <ContentPresenter/>
                        </controls:ClippingBorder>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DropShadowBorder style -->
    <Style TargetType="controls:DropShadowBorder">
        <Setter Property="DropShadowOpacity" Value="0.5"/>
        <Setter Property="DropShadowColor" Value="#ff000000"/>
        <Setter Property="DropShadowAngle" Value="45"/>
        <Setter Property="DropShadowDistance" Value="20"/>
        <Setter Property="DropShadowSpread" Value="0"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:DropShadowBorder">
                    <Grid>
                        <Border Opacity="{TemplateBinding DropShadowOpacity}" 
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch" 
                                CornerRadius="{TemplateBinding ShadowCornerRadius}" 
                                IsHitTestVisible="False" 
                                RenderTransformOrigin="0,0" >
                            <Border.RenderTransform>
                                <TranslateTransform x:Name="PART_DropShadowTranslateTransform" X="5" Y="5"/>
                            </Border.RenderTransform>
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0" x:Name="PART_ShadowOuterStop1"/>
                                    <GradientStop Color="#ff000000" Offset="0.1" x:Name="PART_ShadowVertical1"/>
                                    <GradientStop Color="#ff000000" Offset="0.9" x:Name="PART_ShadowVertical2"/>
                                    <GradientStop Color="#00000000" Offset="1" x:Name="PART_ShadowOuterStop2"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border.OpacityMask>
                                <LinearGradientBrush EndPoint="1.0,0.5" StartPoint="0.0,0.5" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0"/>
                                    <GradientStop Color="#FF000000" Offset="0.1" x:Name="PART_ShadowHorizontal1"/>
                                    <GradientStop Color="#FF000000" Offset="0.9" x:Name="PART_ShadowHorizontal2"/>
                                    <GradientStop Color="#00000000" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.OpacityMask>
                        </Border>
                        <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                                 CornerRadius="{TemplateBinding CornerRadius}"
                                                 Padding="{TemplateBinding Padding}"
                                                 BorderThickness="{TemplateBinding BorderThickness}"
                                                 BorderBrush="{TemplateBinding BorderBrush}"
                                                 ClipContent="{TemplateBinding ClipContent}">
                            <ContentPresenter/>
                        </controls:ClippingBorder>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- OuterGlowBorder style -->
    <Style TargetType="controls:OuterGlowBorder">
        <Setter Property="OuterGlowSize" Value="10"/>
        <Setter Property="OuterGlowOpacity" Value="0.5"/>
        <Setter Property="OuterGlowColor" Value="#ff000000"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:OuterGlowBorder">
                    <Grid>
                        <Border x:Name="PART_OuterGlowBorder" 
                                Opacity="{TemplateBinding OuterGlowOpacity}" 
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch" 
                                CornerRadius="{TemplateBinding ShadowCornerRadius}" 
                                IsHitTestVisible="False">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0" x:Name="PART_ShadowOuterStop1"/>
                                    <GradientStop Color="#ff000000" Offset="0.1" x:Name="PART_ShadowVertical1"/>
                                    <GradientStop Color="#ff000000" Offset="0.9" x:Name="PART_ShadowVertical2"/>
                                    <GradientStop Color="#00000000" Offset="1" x:Name="PART_ShadowOuterStop2"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border.OpacityMask>
                                <LinearGradientBrush EndPoint="1.0,0.5" StartPoint="0.0,0.5" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0"/>
                                    <GradientStop Color="#FF000000" Offset="0.1" x:Name="PART_ShadowHorizontal1"/>
                                    <GradientStop Color="#FF000000" Offset="0.9" x:Name="PART_ShadowHorizontal2"/>
                                    <GradientStop Color="#00000000" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.OpacityMask>
                        </Border>
                        <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                                 CornerRadius="{TemplateBinding CornerRadius}"
                                                 Padding="{TemplateBinding Padding}"
                                                 BorderThickness="{TemplateBinding BorderThickness}"
                                                 BorderBrush="{TemplateBinding BorderBrush}"
                                                 ClipContent="{TemplateBinding ClipContent}">
                            <ContentPresenter/>
                        </controls:ClippingBorder>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ClippingBorder style -->
    <Style TargetType="controls:ClippingBorder">
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ClippingBorder">
                    <Border Background="{TemplateBinding Background}" 
                            CornerRadius="{TemplateBinding CornerRadius}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            x:Name="PART_Border">
                        <Grid>
                            <ContentControl x:Name="PART_TopLeftContentControl"
                                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                                <ContentControl.Clip>
                                    <RectangleGeometry x:Name="PART_TopLeftClip"/>
                                </ContentControl.Clip>
                                <ContentControl x:Name="PART_TopRightContentControl"  
                                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                    <ContentControl.Clip>
                                        <RectangleGeometry x:Name="PART_TopRightClip"/>
                                    </ContentControl.Clip>
                                    <ContentControl x:Name="PART_BottomRightContentControl" 
                                                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                        <ContentControl.Clip>
                                            <RectangleGeometry x:Name="PART_BottomRightClip"/>
                                        </ContentControl.Clip>
                                        <ContentControl x:Name="PART_BottomLeftContentControl" 
                                                    HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                                            <ContentControl.Clip>
                                                <RectangleGeometry x:Name="PART_BottomLeftClip"/>
                                            </ContentControl.Clip>
                                            <ContentPresenter Margin="{TemplateBinding Padding}"/>
                                        </ContentControl>
                                    </ContentControl>
                                </ContentControl>
                            </ContentControl>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- InnerGlowBorder style -->
    <Style TargetType="controls:InnerGlowBorder">
        <Setter Property="InnerGlowSize" Value="10,10,10,10"/>
        <Setter Property="InnerGlowOpacity" Value="0.5"/>
        <Setter Property="InnerGlowColor" Value="#ff000000"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="ContentZIndex" Value="0"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:InnerGlowBorder">
                    <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                             CornerRadius="{TemplateBinding CornerRadius}"
                                             BorderThickness="{TemplateBinding BorderThickness}"
                                             BorderBrush="{TemplateBinding BorderBrush}"
                                             ClipContent="{TemplateBinding ClipContent}">
                        <Grid>
                            <ContentPresenter Margin="{TemplateBinding Padding}" Canvas.ZIndex="{TemplateBinding ContentZIndex}"/>
                            <Border x:Name="PART_LeftGlow" IsHitTestVisible="False" Canvas.ZIndex="0"
                                    Opacity="{TemplateBinding InnerGlowOpacity}"
                                    HorizontalAlignment="Left" VerticalAlignment="Stretch"
                                    Width="10">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
                                        <GradientStop Offset="0" Color="#ff000000" x:Name="PART_LeftGlowStop0"/>
                                        <GradientStop Offset="1" Color="#00000000" x:Name="PART_LeftGlowStop1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border x:Name="PART_TopGlow" IsHitTestVisible="False" Canvas.ZIndex="0"
                                    Opacity="{TemplateBinding InnerGlowOpacity}"
                                    HorizontalAlignment="Stretch" VerticalAlignment="Top"
                                    Height="10">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
                                        <GradientStop Offset="0" Color="#ff000000" x:Name="PART_TopGlowStop0"/>
                                        <GradientStop Offset="1" Color="#00000000" x:Name="PART_TopGlowStop1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border x:Name="PART_RightGlow" IsHitTestVisible="False" Canvas.ZIndex="0"
                                    Opacity="{TemplateBinding InnerGlowOpacity}"
                                    HorizontalAlignment="Right" VerticalAlignment="Stretch"
                                    Width="10">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="1, 0.5" EndPoint="0, 0.5">
                                        <GradientStop Offset="0" Color="#ff000000" x:Name="PART_RightGlowStop0"/>
                                        <GradientStop Offset="1" Color="#00000000" x:Name="PART_RightGlowStop1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border x:Name="PART_BottomGlow" IsHitTestVisible="False" Canvas.ZIndex="0"
                                    Opacity="{TemplateBinding InnerGlowOpacity}"
                                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
                                    Height="10">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0.5, 1" EndPoint="0.5, 0">
                                        <GradientStop Offset="0" Color="#ff000000" x:Name="PART_BottomGlowStop0"/>
                                        <GradientStop Offset="1" Color="#00000000" x:Name="PART_BottomGlowStop1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Grid>
                    </controls:ClippingBorder>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- GlassBorder style -->
    <Style TargetType="controls:GlassBorder">
        <Setter Property="GlassOpacity" Value="1"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="ContentZIndex" Value="0"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:GlassBorder">
                    <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                             CornerRadius="{TemplateBinding CornerRadius}"
                                             BorderThickness="{TemplateBinding BorderThickness}"
                                             BorderBrush="{TemplateBinding BorderBrush}"
                                             ClipContent="{TemplateBinding ClipContent}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <ContentPresenter Margin="{TemplateBinding Padding}" Canvas.ZIndex="{TemplateBinding ContentZIndex}" Grid.RowSpan="2"/>
                            <Border Opacity="{TemplateBinding GlassOpacity}" CornerRadius="{TemplateBinding GlassCornerRadius}" Margin="1,1,1,0"
                                    IsHitTestVisible="False">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Color="#ffffffff" Offset="0"/>
                                        <GradientStop Color="#C4ffffff" Offset="0.05"/>
                                        <GradientStop Color="#54ffffff" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Grid>
                    </controls:ClippingBorder>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- PerspectiveShadowBorder style -->
    <Style TargetType="controls:PerspectiveShadowBorder">
        <Setter Property="PerspectiveShadowOpacity" Value="0.5"/>
        <Setter Property="PerspectiveShadowColor" Value="#ff000000"/>
        <Setter Property="PerspectiveShadowAngle" Value="-15"/>
        <Setter Property="PerspectiveShadowSpread" Value="0"/>
        <Setter Property="ClipContent" Value="True"/>
        <Setter Property="Background" Value="#ffffffff"/>
        <Setter Property="BorderBrush" Value="#ff000000"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PerspectiveShadowBorder">
                    <Grid>
                        <Border Opacity="{TemplateBinding PerspectiveShadowOpacity}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                                CornerRadius="{TemplateBinding ShadowCornerRadius}" IsHitTestVisible="False" RenderTransformOrigin="0,1" >
                            <Border.RenderTransform>
                                <TransformGroup>
                                    <SkewTransform AngleX="-15" AngleY="0" x:Name="PART_PerspectiveShadowSkewTransform"/>
                                    <ScaleTransform ScaleX="1" ScaleY="1" x:Name="PART_PerspectiveShadowScaleTransform"/>
                                </TransformGroup>
                            </Border.RenderTransform>
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0" x:Name="PART_ShadowOuterStop1"/>
                                    <GradientStop Color="#ff000000" Offset="0.1" x:Name="PART_ShadowVertical1"/>
                                    <GradientStop Color="#ff000000" Offset="0.9" x:Name="PART_ShadowVertical2"/>
                                    <GradientStop Color="#00000000" Offset="1" x:Name="PART_ShadowOuterStop2"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border.OpacityMask>
                                <LinearGradientBrush EndPoint="1.0,0.5" StartPoint="0.0,0.5" MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#00000000" Offset="0"/>
                                    <GradientStop Color="#FF000000" Offset="0.1" x:Name="PART_ShadowHorizontal1"/>
                                    <GradientStop Color="#FF000000" Offset="0.9" x:Name="PART_ShadowHorizontal2"/>
                                    <GradientStop Color="#00000000" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.OpacityMask>
                        </Border>
                        <controls:ClippingBorder Background="{TemplateBinding Background}" 
                                                 CornerRadius="{TemplateBinding CornerRadius}"
                                                 Padding="{TemplateBinding Padding}"
                                                 BorderThickness="{TemplateBinding BorderThickness}"
                                                 BorderBrush="{TemplateBinding BorderBrush}"
                                                 ClipContent="{TemplateBinding ClipContent}">
                            <ContentPresenter/>
                        </controls:ClippingBorder>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>